package com.cloud.gatewaySpringSecurity.exception;

import lombok.Getter;

/**
 * @author zhozixiong
 * @date 2022/10/03
 *
 * 自定义异常类
 */
@Getter
public class CustomException extends RuntimeException {

    private int code = 500;

    private String message;

    public CustomException(String message) {
        super(message);
        this.message = message;
    }

    public CustomException(String message, Throwable e) {
        super(message, e);
        this.message = message;
    }

    public CustomException(int code, String message) {
        super(message);
        this.code = code;
        this.message = message;
    }

    public CustomException(int code, String message, Throwable e) {
        super(message, e);
        this.code = code;
        this.message = message;
    }

    @Override
    public String toString() {
        return String.format("code:%s\tmessage:%s", this.code, this.message);
    }
}
